package com.syedu.day10.example2;

import static com.syedu.day10.example2.IConstants.*;
import static com.syedu.day10.example2.VehicleFactory.*;

/**
 * description：
 * @author Administrator
 * @date 2022/3/21 15:36
 */
public class TestVehicle {
    public static void main(String[] args) {
        VehicleService service = VehicleService.getService();
        Vehicle vehicle = getVehice(BIKE);
        vehicle.setSpeed(900.0);
        //判断对象是否实现标记接口
        if(vehicle instanceof ICheck && vehicle.getSpeed()>80){
            System.out.println("超速了...");
        }else{
            service.goToWork(vehicle);
        }
    }
}